﻿using System;
class CalculatingString
{
    static int CalculatinStringValues(string values)
    {
        int result = 0;
        string[] numbers = values.Split(' ');
        for (int i = 0; i < numbers.Length; i++)
        {
            try
            {
                result = result + int.Parse(numbers[i]);
            }
            catch (FormatException)
            {
                Console.Write("reenter number. not in wanted format: ");
                return -1;
            }
            catch (OverflowException)
            {
                Console.Write("overflow: ");
                return -1;
            }
        }
        return result;
    }
    static void Main()
    {
        Console.Write("please insert values: ");
        string values = Console.ReadLine();
        int result = CalculatinStringValues(values);
        Console.Write("the sum is: ");
        Console.WriteLine(result);
        Console.ReadLine();
    }
}

